import { Controller, Get, Post, Body, Patch, Param, Delete, Req, Res } from '@nestjs/common';
import { VerifyCodeService } from './verify-code.service';
import { CreateVerifyCodeDto } from './dto/create-verify-code.dto';
import { UpdateVerifyCodeDto } from './dto/update-verify-code.dto';

// 知识点
// 1、session使用
// npm i express-session --save
// npm i @types/express-session -D



// 2、字符验证码的使用
// npm install svg-captcha -S

@Controller('verify-code')
export class VerifyCodeController {
  constructor(private readonly verifyCodeService: VerifyCodeService) {}

  @Get('createStrCode')
  createStrCode(@Req() req, @Res() res) {
    this.verifyCodeService.createStrCode(req, res);
  }

  @Post('submitStrCode')
  submitStrCode(@Req() req, @Res() res) {
    let rep = this.verifyCodeService.submitStrCode(req, res);
    res.send(rep);
  }
}
